require("../css/course.less");

const utils = require('../utils/utils.js');

const axios = require("../utils/axiosUtil.js");

const baseUrl = require("../utils/baseUrl.js");

window.onload = function () {
    utils.footer("sports");
    let zuix = document.querySelector(".course-content");
    let kec = document.querySelector(".course");

    axios.get("/api/train/courseList").then(function (res) {
        let datas =  res.data.data;
        let data = datas[0];
        console.log(data);
        //渲染页面
        zuix.innerHTML = `
        <div class="course-img">
        <img src="${baseUrl + data.imgurl}" alt="">
           </div>
        <div class="desc">${data.name}</div>
        <div class="text">${data.desc} </div>
        `
        let html = "";
        datas.forEach(function(item,index){
            html+=`
            
            
            <a href="./conInfo.html?id=${item.courseId}">
            <div class="content">
            <img src="${baseUrl + item.imgurl}" alt="">
        <div class="content-img">
        </div>
            <div class="desc">${item.name}</div>
            <div class="text">${item.desc}</div>
          </div>
    </a>
            `
        })
        kec.innerHTML = `
        <h5>课程</h5>
        `+ html

    })






}

